function  login(){
    // var username = $("#username").val();
    // var password = $("#password").val();
    let username = document.getElementById("username").value;
    let password =document.getElementById("password").value;

    // console.log(username,password);


    if(isEmpty(username ) ){
        document.getElementById("msg").innerHTML = "用户名不能为空"
        return;
    }
    if(isEmpty(password)){
        document.getElementById("msg").innerHTML = "密码不能为空";
        return;
    }
    // console.log(document.getElementById("msg").html,document.getElementById("msg").html);
    document.getElementById("loginMessage").submit();
}

function registerUser(){
    let username = document.getElementById("newusername").value;
    let password =document.getElementById("newpassword").value;

    if(isEmpty(username) ){
        document.getElementById("msg").innerHTML = "用户名不能为空"
        return;
    }
    if(isEmpty(password)){
        document.getElementById("msg").innerHTML = "密码不能为空";
        return;
    }

    document.getElementById("registerMessage").submit();
}



function isEmpty(str) {
    if(str == null || str.trim(str)==""){
        return true;
    }
    return false;

}